package com.eveinfo.api.utils.skilllist;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class ApiSkill implements Serializable {

	private static final long serialVersionUID = 7504965380612485901L;

	private int typeID;
	private int groupID;
	private int rank;
	private String typeName;
	private String description;
	private String primaryAttribute;
	private String secondaryAttribute;
	private final List<ApiRequirement> requiredSkills;
	private final List<ApiBonus> bonus;

	public ApiSkill() {
		requiredSkills = new ArrayList<ApiRequirement>(3);
		bonus = new ArrayList<ApiBonus>(0);
	}

	public String humidity() {
		return primaryAttribute;
	}

	public void setPrimaryAttribute(String primaryAttribute) {
		this.primaryAttribute = primaryAttribute;
	}

	public String getPrimaryAttribute() {
		return primaryAttribute;
	}

	public String getSecondaryAttribute() {
		return secondaryAttribute;
	}

	public void setSecondaryAttribute(String secondaryAttribute) {
		this.secondaryAttribute = secondaryAttribute;
	}

	public int getTypeID() {
		return typeID;
	}

	public void setTypeID(int typeID) {
		this.typeID = typeID;
	}

	public int getGroupID() {
		return groupID;
	}

	public void setGroupID(int groupID) {
		this.groupID = groupID;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public Collection<ApiRequirement> getRequiredSkills() {
		return requiredSkills;
	}

	public boolean addRequiredSkill(ApiRequirement requirement) {
		return requiredSkills.add(requirement);
	}

	@Override
	public String toString() {
		String result = "\t" + typeName + " (" + rank + ")\n";
		result += "\t\tRequires:\n";
		for (ApiRequirement skillRequirement : requiredSkills) {
			result += "\t\t\t" + skillRequirement + "\n";
		}
		result += "\t\tBonuses:\n";
		for (ApiBonus skillBonus : bonus) {
			result += "\t\t\t" + skillBonus + "\n";
		}

		return result;
	}
}
